package com.yjm.test.Spring5.ch4.messageSource;

import java.util.Locale;

import org.springframework.context.support.GenericApplicationContext;
import org.springframework.context.support.GenericXmlApplicationContext;

public class MessageSourceDemo {

	public static void main(String[] args) {
		GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
		ctx.load("classpath:spring/ch4/message-source-demo.xml");
		ctx.refresh();
		
		Locale english = Locale.ENGLISH;
		Locale german = new Locale("de", "DE");
		
		System.out.println(ctx.getMessage("msg", null, english));
		System.out.println(ctx.getMessage("msg", null, german));
		System.out.println("\n\n\n");
		System.out.println(ctx.getMessage("nameMsg", new Object[] {"john","Mayer"}, english));
		System.out.println(ctx.getMessage("nameMsg", new Object[] {"john","Mayer"}, german));
		
		
		ctx.close();
	}

}
